![]() |
PATH![]() |
This section describes the format of JManager callback functions you must implement in your application.
Sends text to output. This is how you would define your output function if you were to name it MyStandardOutput:
void MyStandardOutput (
JMSessionRef session,
const char* message,
UInt32 messageLen);
When invoking the Java runtime environment using JMOpenSession , you must designate a callback function to display any console output received from the session.
Directs error output. This is how you would define your error function if you were to name it MyStandardError:
void MyStandardError (
JMSessionRef session,
const char* message,
UInt32 messageLen);
When invoking the Java runtime environment using JMOpenSession , you must designate a callback function to direct any error output received from the session.The MyStandardError function has the same form as the MyStandardOutput callback function.
The
MyStandardOutput
function
MyStandardOutput
.
Reads text input. This is how you would define your input function if you were to name it MyStandardIn:
SInt32 MyStandardIn (JMSessionRef session,
char* buffer,
SInt32 maxBufferLength);
When invoking the Java runtime environment using JMOpenSession , you must designate a callback function to direct any console input to the session.
Handles calls to java.lang.System.exit . This is how you would define your input function if you were to name it MyExit:
Boolean MyExit (JMSessionRef session,
int value);
When invoking the Java runtime environment using JMOpenSession , you must designate a callback function (called MyExit here) to handle requests to quit. When a Java applet or application calls java.lang.System.exit , the session calls MyExit . Note that instead of passing false back to the session, you can simply dispose of the session and exit from within the MyExit function.
Handles an authentication request for a URL. This is how you would define your authentication function if you were to name it MyAuthenticate:
Boolean MyAuthenticate (
JMSessionRef session,
const char* url,
const char* realm,
char userName[255],
char password[255]);
When invoking the Java runtime environment using JMOpenSession , you can designate a callback function to handle any authentication requests from a URL. This callback should prompt the user for a name and password, and pass them back to the session. If you do not indicate an authentication callback, the Java session will prompt the user with its own authentication dialog box.
Handles a low-memory condition. This is how you would define your low-memory function if you were to name it MyLowMem:
void MyLowMem (JMSessionRef session);
When invoking the Java runtime environment using JMOpenSession , you can designate a callback function to be called if the Java session runs low on memory. This callback typically notifies the user of the low-memory condition and suggests possible actions to take.
Creates a new frame. This is how you would define your frame request function if you were to name it MyRequestFrame:
OSStatus MyRequestFrame (
JMAWTContextRef context,
JMFrameRef newFrame,
JMFrameKind kind,
const Rect* initialBounds,
Boolean resizeable,
JMFrameCallbacks* callbacks);
When instantiating an AWT context, you must designate a callback function to handle requests for new frames.
Releases the frame. This is how you would define your frame release function if you were to name it MyReleaseFrame:
OSStatus MyReleaseFrame (
JMAWTContextRef context,
JMFrameRef oldFrame);
When instantiating an AWT context, you must designate a callback function to release existing frames.
Allocates a new menu ID. This is how you would define your menu ID allocation function if you were to name it MyUniqueMenuID:
typedef SInt16 MyUniqueMenuID (
JMAWTContextRef context,
Boolean isSubmenu);
When instantiating an AWT context, you must designate a callback function to create new menu IDs if necessary.
Indicates that an exception occurred. This is how you would define your exception notification function if you were to name it MyExceptionOccurred:
void MyExceptionOccurred (
JMAWTContextRef context,
const JMTextRef exceptionName,
const JMTextRef exceptionMsg,
const JMTextRef stackTrace);
When instantiating an AWT context, you must designate a callback function to notify that an exception has occurred. You cannot use this function to recover from the exception; this function indicates only that an exception has occurred.
Handles a request to change the size of a frame. This is how you would define your frame resize function if you were to name it MyResizeRequest:
Boolean MyResizeRequest (
JMFrameRef frame,
Rect* newBounds);
When creating a frame, you must designate a callback function to resize the frame if necessary. The function can refuse the resize request or adjust the frame size to something other than the requested dimensions. If your function sets a new frame size, you can modify the value of the newBounds parameter to reflect the new dimensions.
Handles a frame invalidation request. This is how you would define your invalidation request function if you were to name it MyInvalRect:
void MyInvalRect (JMFrameRef frame,
const Rect* dimens);
When creating a frame you must designate a callback function to invalidate a portion of the frame if necessary (in a manner similar to the MacOS Toolbox function call InvalRect ). The invalid portion can be updated later using the JMFrameUpdate function.
The
JMFrameUpdate
function
JMFrameUpdate
.
Shows or hides a window associated with a frame. This is how you would define your show/hide function if you were to name it MyShowHide:
void MyShowHide (JMFrameRef frame,
Boolean showFrameRequested);
When creating a frame, you must designate a callback function to show or hide the window associated with it.
Sets the title bar text for the frame. This is how you would define your title bar function if you were to name it MySetTitle:
void MySetTitle (JMFrameRef frame,
const JMTextRef title);
When creating a frame you must designate a callback function to set or modify the title bar associated with it.
Checks to see if a frame update is necessary. This is how you would define your update check function if you were to name it MyCheckUpdate:
void MyCheckUpdate (JMFrameRef frame);
When creating a frame you must designate a callback function to check if a frame update is needed. This function may be called to enable updates for interactions such as live scrolling or other mouse-tracking maneuvers. If the function determines that an update is necessary (that is, the update region is not empty), it should call JMFrameUpdate in addition to the usual Window Manager calls ( BeginUpdate , EndUpdate , and so on) to perform the update.
The
JMFrameUpdate
function
JMFrameUpdate
.
Reorders the frame. This is how you would define your frame reorder function if you were to name it MyFrameReorder:
void MyFrameReorder (
JMFrameRef frame,
enum ReorderRequest theRequest);
When creating a frame you must designate a callback function to reorder the frame if necessary (for example, to bring it to the front or send it to the back). Note that you should not reorder frames such that a modal frame appears on top of a nonmodal one.
Designates whether a frame is resizeable. This is how you would define your set resizeable function if you were to name it MySetResizeable:
void MySetResizeable (
JMFrameRef frame,
Boolean resizeable);
When creating a frame you must designate a callback function to set the frame as resizeable or not. The callback can allow or disallow the use of the grow control depending on the value of resizeable .
Executes after an attempt to retrieve HTML data using the JMNewAppletLocator function. This is how you would define your output function if you were to name it MyFetchCompleted:
void MyFetchCompleted (
JMAppletLocatorRef ref,
JMLocatorErrors status);
When calling JMNewAppletLocator , you must designate this function in the applet locator callbacks structure. The actions taken by the completion function depend on the status value it receives from JMNewAppletLocator . For example, if the HTML text is retrieved successfully, the function can then proceed to instantiate an applet associated with the HTML page.
The
JMNewAppletLocator
function
JMNewAppletLocator
.
Displays the contents of a URL passed back by an instantiated applet. This is how you would define your output function if you were to name it MyShowDocument:
void MyShowDocument (JMAppletViewerRef viewer,
const JMTextRef urlString,
const JMTextRef windowName);
When calling JMNewAppletViewer , you must designate this function in the applet callbacks structure.
The session passes one of the strings in Table 2-1 in the WindowName parameter, and your application should display the URL contents accordingly.
The
JMNewAppletViewer
function
JMNewAppletViewer
.
Handles any status messages passed back by an instantiated applet. This is how you would define your output function if you were to name it MySetStatusMsg:
void MySetStatusMsg (JMAppletViewerRef viewer,
const char* statusMsg);
When calling JMNewAppletViewer , you must designate this function in the applet callbacks data structure. The function can display the status message or ignore it, whichever is appropriate.
The
JMNewAppletViewer
function.